package de.muahd.saga.ui.vaadin.config;

import org.dellroad.stuff.vaadin.VaadinApplicationScope;
import org.springframework.beans.factory.aspectj.EnableSpringConfigured;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
import org.springframework.validation.beanvalidation.MethodValidationPostProcessor;

import de.muahd.saga.services.core.config.CoreApplication;

@Configuration
@ComponentScan(basePackages={"de.muahd.saga"})
@EnableSpringConfigured
@Import(value={CoreApplication.class})
public class SpringApplication {

	@Bean
	public LocalValidatorFactoryBean validator() {
		return new LocalValidatorFactoryBean();
	}

	@Bean
	public MethodValidationPostProcessor methodValidationPostProcessor() {
		return new MethodValidationPostProcessor();
	}

	@Bean
	public VaadinApplicationScope vaadinApplicationScope() {
		VaadinApplicationScope scope = new VaadinApplicationScope();

		return scope;
	}


}
